/**
 * 
 */
package com.epcs.subGNuevosNegocios.eci.struts.action.base;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;

import org.apache.log4j.Logger;
import org.apache.struts.actions.DispatchAction;

/**
 * @author Nicolas Figueroa
 *
 */
public class BaseAction extends DispatchAction{

	/**
	 * Variables
	 */
	//public static Logger logger =
    //    Logger.getLogger(BaseAction.class);

	public ResultSet executeQuery(HttpServletRequest request, String query)
	{
		DataSource dataSource;
		Connection connection;
		Statement stmt;
		ResultSet rs;
		try{
			dataSource = getDataSource(request, "dataSourceOracle");
			connection = dataSource.getConnection();
			stmt = connection.prepareStatement(query);
			rs = stmt.executeQuery(query);
			return rs;
		}catch(Exception e)
		{
			e.printStackTrace();
		}
		return null;
	}
	
	public void executeProcedure(HttpServletRequest request, String procedure, String parametros)
	{
		DataSource dataSource;
		Connection connection;
		try{
			dataSource = getDataSource(request, "dataSourceOracle");
			connection = dataSource.getConnection();
			CallableStatement stmtProcedure = connection.prepareCall("");
			
		}catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
}
